package com.gljx.web.service.impl;

import com.gljx.web.Entity.RemunProvide;
import com.gljx.web.dao.CommonDao;
import com.gljx.web.dao.RemunProvideMapper;
import com.gljx.web.service.RemunProvideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Transactional
public class RemunProvideServiceImpl extends CommonDao implements RemunProvideService {
	
	@Autowired
    private RemunProvideMapper remunProvideMapper;
	
	/**
	 * 查找最大编码
	 * @return
	 */
	@Override
	public String selectFnumber(String companyId) {
		// TODO Auto-generated method stub
		return remunProvideMapper.selectFnumber(companyId);
	}
	/**
	 * 增加薪酬发放
	 */
	@Override
	public int addRemunProvide(RemunProvide remunProvide) {
		// TODO Auto-generated method stub
		return remunProvideMapper.insertSelective(remunProvide);
	}
	/**
	 *根据fid查找薪酬薪资信息 
	 */
	@Override
	public RemunProvide selectByPrimaryKey(String fid) {
		// TODO Auto-generated method stub
		return remunProvideMapper.selectByPrimaryKey(fid);
	}
	/**
	 * 修改薪酬薪資
	 */
	@Override
	public int updateByPrimaryKeySelective(RemunProvide remunProvide) {
		// TODO Auto-generated method stub
		return remunProvideMapper.updateByPrimaryKeySelective(remunProvide);
	}
	/**
	 * 根据fid删除薪酬薪资
	 */
	@Override
	public int deleteByPrimaryKey(String fid) {
		// TODO Auto-generated method stub
		return remunProvideMapper.deleteByPrimaryKey(fid);
		
		
	}

	@Override
	public List<RemunProvide> selRemunProvideByFnumber(String fnumber, String companyId) {
		return remunProvideMapper.selRemunProvideByFnumber(fnumber,companyId);
	}

	@Override
	public Map<String, Object> selectPageCount(String psql) {
		// TODO Auto-generated method stub
		Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("Psql", psql);
        paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
        this.getSqlSession().select("com.gljx.web.dao.RemunProvideMapper.pagecount", paramMap, null);
        return paramMap;
	}
	@Override
	public Map<String, Object> selectPage(int pindex, String psql, int psize) {
		// TODO Auto-generated method stub
		Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("Pindex", pindex);
        paramMap.put("Psql", psql);
        paramMap.put("Psize", psize);
        paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
        paramMap.put("v_cur", oracle.jdbc.OracleTypes.CURSOR);
        this.getSqlSession().select("com.gljx.web.dao.RemunProvideMapper.pagemap", paramMap, null);
        return paramMap;
	}
	@Override
	public RemunProvide selRemunProvideByFid(String fcompanyid, String fid) {
		// TODO Auto-generated method stub
		return remunProvideMapper.selRemunProvide(fcompanyid, fid);
	}

}
